package com.aspose.cells;

import java.util.Iterator;

class zrp {
   private BuiltInDocumentPropertyCollection a;
   private CustomDocumentPropertyCollection b;
   private zavs c;
   private zavs d;
   private zavs e;
   private static DateTime f = new DateTime(1601, 1, 1);

   void a(zane var1, BuiltInDocumentPropertyCollection var2, CustomDocumentPropertyCollection var3) throws Exception {
      try {
         this.a = var2;
         this.b = var3;
         com.aspose.cells.b.a.d.zh var4 = var1.a("\u0005SummaryInformation");
         if (var4 != null) {
            this.a((com.aspose.cells.b.a.d.zm)var4);
         }

         com.aspose.cells.b.a.d.zh var5 = var1.a("\u0005DocumentSummaryInformation");
         if (var5 != null) {
            this.b(var5);
         }
      } catch (Exception var6) {
         ;
      }

   }

   private void a(com.aspose.cells.b.a.d.zm var1) throws Exception {
      zavr var2 = new zavr(var1);
      if (var2.a().size() > 0) {
         zavp var3 = var2.a().a(0).b();
         a(var3, this.a, 0);
      }

   }

   private void b(com.aspose.cells.b.a.d.zm var1) throws Exception {
      zavr var2 = new zavr(var1);
      zavp var3;
      if (var2.a().size() > 0) {
         var3 = var2.a().a(0).b();
         a(var3, this.a, 1);
      }

      if (var2.a().size() > 1) {
         var3 = var2.a().a(1).b();
         a(var3, this.b, 2);
      }

   }

   private static void a(zavp var0, DocumentPropertyCollection var1, int var2) throws Exception {
      for(int var3 = 0; var3 < var0.size(); ++var3) {
         zavo var4;
         String var5;
         var4 = var0.a(var3);
         label29:
         switch(var2) {
         case 0:
            var5 = BuiltInDocumentPropertyCollection.a(var4.a, var2);
            switch(var4.a) {
            case 9:
               try {
                  var4.c = com.aspose.cells.b.a.zo.a((String)var4.c);
               } catch (Exception var7) {
                  var4.c = 0;
               }
               break label29;
            case 10:
               com.aspose.cells.b.a.zk var6 = com.aspose.cells.a.c.zk.e((DateTime)var4.c, f);
               var4.c = var6.d();
            default:
               break label29;
            }
         case 1:
            var5 = BuiltInDocumentPropertyCollection.a(var4.a, var2);
            break;
         case 2:
            var5 = var4.b;
            break;
         default:
            throw new Exception("Unknown property group type.");
         }

         boolean var8 = false;
         if (var5 == null) {
            var5 = "퀀_generated_" + var2 + "." + var4.a;
            var8 = true;
         }

         var1.a(var2, var4.a, var5, var4.c, var8);
      }

   }

   static byte[] a(String var0) {
      byte[] var1 = Encoding.getUnicode().a(var0);
      byte[] var2 = new byte[var1.length + 2];
      System.arraycopy(var1, 0, var2, 0, var1.length);
      return var2;
   }

   void a(BuiltInDocumentPropertyCollection var1, CustomDocumentPropertyCollection var2, zane var3) throws Exception {
      String var4 = null;
      this.a = var1;
      if (var1.contains("HyperlinkBase")) {
         var4 = var1.getHyperlinkBase();
         var1.remove("HyperlinkBase");
         if (var4 != null && !"".equals(var4)) {
            var2.remove("_PID_LINKBASE");
            var2.a("_PID_LINKBASE", a(var4));
         }
      }

      this.b = var2;
      zavr var5 = new zavr();
      this.c = new zavs(zavs.a);
      com.aspose.cells.b.a.a.ze.a(var5.a(), (Object)this.c);
      zavr var6 = new zavr();
      this.d = new zavs(zavs.b);
      com.aspose.cells.b.a.a.ze.a(var6.a(), (Object)this.d);
      this.e = new zavs(zavs.c);
      com.aspose.cells.b.a.a.ze.a(var6.a(), (Object)this.e);
      this.a((DocumentPropertyCollection)this.a);
      this.a((DocumentPropertyCollection)this.b);
      if (this.e.b().size() == 0) {
         var6.a().remove(this.e);
      }

      com.aspose.cells.b.a.d.zh var7 = new com.aspose.cells.b.a.d.zh();
      var5.a(var7);
      var3.b("\u0005SummaryInformation", var7);
      com.aspose.cells.b.a.d.zh var8 = new com.aspose.cells.b.a.d.zh();
      var6.a(var8);
      var3.b("\u0005DocumentSummaryInformation", var8);
      if (var4 != null && !"".equals(var4)) {
         var1.setHyperlinkBase(var4);
         var2.remove("_PID_LINKBASE");
      }

   }

   private void a(DocumentPropertyCollection var1) throws Exception {
      Iterator var2 = var1.iterator();

      while(var2.hasNext()) {
         DocumentProperty var3 = (DocumentProperty)var2.next();
         switch(var3.d()) {
         case 0:
            Object var6 = var3.getValue();
            switch(var3.a()) {
            case 9:
               var6 = com.aspose.cells.b.a.zr.a(var6);
               break;
            case 10:
               com.aspose.cells.b.a.zk var5 = com.aspose.cells.b.a.zk.b((Double)var6);
               var6 = com.aspose.cells.a.c.zk.a(f, var5);
            }

            com.aspose.cells.b.a.a.ze.a(this.c.b(), (Object)(new zavo(var3.a(), (String)null, var6)));
            break;
         case 1:
            com.aspose.cells.b.a.a.ze.a(this.d.b(), (Object)(new zavo(var3.a(), (String)null, var3.getValue())));
            break;
         case 2:
            String var4 = var3.isGeneratedName() ? null : var3.getName();
            com.aspose.cells.b.a.a.ze.a(this.e.b(), (Object)(new zavo(var3.a(), var4, var3.getValue())));
            break;
         default:
            throw new Exception("Unknown property group.");
         }
      }

   }
}
